package com.example.demo.web.utils;

import com.example.demo.web.config.JwtConfig;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class JwtService {
    @Autowired
    private JwtConfig jwtConfig;

    public Long getUid(HttpServletRequest request) {
        String token = request.getHeader(jwtConfig.getHeader());
        String uid = jwtConfig.getUsernameFromToken(token);
        return Long.parseLong(uid);
    }
}
